<script setup lang="ts">
import { OButton, ODialog } from '@opensig/opendesign';
import { useDialogStore } from '@/stores/common.ts';
import { storeToRefs } from 'pinia';
import { login } from '@/utils/login.ts';

const dialogStore = useDialogStore();
const { loginVisible } = storeToRefs(dialogStore);

const closeDialog = () => {
  dialogStore.setLoginVisible(false);
};
const toLogin = () => {
  closeDialog();
  login();
};
</script>

<template>
  <ODialog :visible="loginVisible" class="center-dialog small-dialog">
    <template #header>登录提示</template>
    <span>请登录后完成该操作</span>
    <template #footer>
      <OButton size="large" color="primary" variant="solid" round="pill" @click="toLogin">登录</OButton>
      <OButton size="large" color="primary" variant="outline" round="pill" @click="closeDialog">关闭</OButton>
    </template>
  </ODialog>
</template>

<style scoped lang="scss"></style>